const { app } = require('./init/initServe');
const bodyParser = require('koa-bodyparser');
const SERVERCONFIG = require('./config/server.config');
const initModel = require('./init/initModel');
const initController = require('./init/initController');
const koaBody = require('koa-body');
const static = require('koa-static');
const path = require("path");
const catchError = require('./middlewares/exception')

initModel();
app.use(catchError);
app.use(static(path.join(__dirname, './public'))) // 设置可访问的静态资源
app.use(koaBody({multipart: true}));
app.use(bodyParser());
initController();
console.log('测试git');
app.listen(SERVERCONFIG.PORT,SERVERCONFIG.HOSTNAME, ()=>{
  console.log(`服务器运行在 http://${SERVERCONFIG.HOSTNAME}:${SERVERCONFIG.PORT}/`);
});

